package com.windy.windyplayer;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.windy.player.GiraffePlayer;
import com.windy.player.IjkVideoView;

import tv.danmaku.ijk.media.player.IjkMediaPlayer;

public class MainActivity extends AppCompatActivity {

    GiraffePlayer mPlayer;

//    final static String url = "http://resource.wisdom.xzh.crazy.weigame.com/media/video/2016/04/06/13/c91fd4e684ce726c4fce937179a6dec7.mp4";
    String url = "/sdcard/shark.mp4";
    String url2 = "/sdcard/ming.rmvb";


    IjkVideoView mViewView;

    IjkMediaPlayer mMediaPlayer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mPlayer = new GiraffePlayer(this);
        play();
//
//
//        mViewView = (IjkVideoView) findViewById(R.id.videoView);
//        mViewView.setVideoPath(url);
//        mViewView.start();


        findViewById(R.id.btnTextureView).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this, TextureViewDemo.class);
                startActivity(intent);
            }
        });

        findViewById(R.id.btnCameraPreview).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this, CameraPreview.class);
                startActivity(intent);
            }
        });
    }

    private void play() {
        mPlayer.setTitle(url);
        mPlayer.play(url);
    }

}
